package cn.honglian.basic.util;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AjaxResult {
    private Boolean success;
    private String msg;

    private Object resultObj;

    public static AjaxResult me(){

        return new AjaxResult();
    }

    public static AjaxResult success(Object path){
        return AjaxResult.me().setSuccess(true).setMsg("操作成功").setResultObj(path);
    }
    public static AjaxResult success(){
        return AjaxResult.me().setSuccess(true).setMsg("操作成功");
    }

    public static AjaxResult fail(){
        return AjaxResult.me().setSuccess(false).setMsg("失败");

    }
    public static AjaxResult fail(String msg){
        return AjaxResult.me().setSuccess(false).setMsg(msg);

    }


    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }



    public AjaxResult setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public AjaxResult setResultObj(Object resultObj) {
        this.resultObj=resultObj;
        return this;
    }

}
